<?php
	class AreaAction extends BaseAction{
		public function addarea(){
			if(!$this->isPost()){
				$this->display();
			}else{
				$data['a_name'] = $_POST['quyu'];
				$result = M("area")->data($data)->add();
				if($result){
					echo "添加成功";
				}
			}
		}

		public function listarea(){
			if(!$this->isPost()){
				$result = M("area")->select();
				$this->assign("area",$result);
				$this->display();
			}else{
				$a_id = $_POST['a_id'];
				$result = M("area")->where("a_id = $a_id")->delete();
				if($result){
					echo 1;
				}else{
					echo 0;
				}
			}

		}

		public function addsubway(){
			if(!$this->isPost()){
				$this->display();
			}else{
				$data['s_name'] = $_POST['s_name'];
				$data['f_value'] = $_POST['f_value'];
				$result = M("subway")->data($data)->add();
				if($result){
					echo "添加成功";
				}else{
					echo "添加失败";
				}
			}
		}

		public function listsubway(){
			if(!$this->isPost()){
				$result = M("subway")->select();
				$this->assign("subway",$result);
				$this->display();
			}else{
				$s_id = $_POST['s_id'];
				$result = M("subway")->where("s_id = $s_id")->delete();
				if($result){
					echo 1;
				}else{
					echo 0;
				}
			}
		}

		public function district(){
			if(!$this->isPost()){
				$this->display();
			}else{
				$data['d_name'] = $_POST['district'];
				$result = M("district")->data($data)->add();
				if($result){
					$this->assign("jumpUrl","__URL__/district");
					$this->assign("waitSecond",3);
					$this->success("商圈添加成功！！！");
				}else{
					$this->assign("jumpUrl","__URL__/district");
					$this->assign("waitSecond",3);
					$this->error("商圈添加失败！！！");
				
				}

			}
		
		}
	
	}

?>